<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title>{$sysinfo['title']}</title>
    <link rel="stylesheet" href="/static/css/weui.css" />
    <link rel="stylesheet" href="/static/css/services.css" />
</head>
<style>


</style>
<body>
<div class="page">
    <div>
        <div class="kh_code">
            <img src="{$qrcode}" id="code_img"/>
        </div>
        <div class="kh_text">长按保存独立推广二维码</div>
    </div>
    <div class="footer">
        <!--<iframe id="saveImg" src="{$qrcode}" style="display:none;"></iframe>-->
        <!--<a class=" click_button kh_btn" style="padding: 10px 100px;" id="kh_btn" href="#" onclick="downloadImg();">点击下载</a>-->
    </div>
</div>
</body>
<script src="/static/js/jquery-3.2.1.js"></script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>

<script>
    function downloadImg(){

        var img = document.getElementById('code_img');   // 获取要下载的图片
        var url = img.src;                              // 获取图片地址
        var a = document.createElement('a');            // 创建一个a节点插入的document
        var event = new MouseEvent('click')             // 模拟鼠标click点击事件
        a.download = 'beautifulGirl'                    // 设置a节点的download属性值

        a.href = url;                                   // 将图片的src赋值给a节点的href
        a.dispatchEvent(event)                          // 触发鼠标点击事件
    }
</script>
<script>
    function downloadImg(){
        var loalIds=$("#code_img").attr("src");
        wx.uploadImage({
            localId:loalIds.toString(),
            isShowProgressTips:1,
            success:function(res){
                var serverId=res.serverId;
                console.log(111,serverId);
                wx.downloadImage({
                    serverId:serverId , // 需要下载的图片的服务器端ID，由uploadImage接口获得
                    isShowProgressTips: 1, // 默认为1，显示进度提示
                    success: function (res) {
                        var localId = res.localId; // 返回图片下载后的本地ID
                    }
                });
            }
        })
    }
</script>
</html>
